﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{
    class GB1182
    {


        private static double distance(Vector3 pp1, Vector2 pp2)
        {
            double dist;
            dist = Math.Sqrt(Math.Pow((pp2.X - pp1.X), 2) + Math.Pow((pp2.Y - pp1.Y), 2));
            return dist;
        }
        private static double distance1(Vector2 pp1, Vector2 pp2)
        {
            double dist;
            dist = Math.Sqrt(Math.Pow((pp2.X - pp1.X), 2) + Math.Pow((pp2.Y - pp1.Y), 2));
            return dist;
        }
        private static void dimrot(DxfDocument dxf1, Vector2 fp1, Vector2 fp2, double ang, double offset, String text, String toh, String tol)
        {
            Vector2 fp1p = fp1;
            Vector2 fp2p = fp2;
            if (fp2.Y > fp1.Y) { fp1 = fp2p; fp2 = fp1p; }

            double pi = 3.1415926535897;
            //       if (text.Contains("φ")) text = text+"  ";

            /*            double ang1,angp;
                        if (fp2.X == fp1.X)
                        {
                            if (fp2.Y > fp1.Y) ang1 = 90;
                            else ang1 = -90;
                        }
                        else
                        {
                            ang1=Math.Atan((fp2.Y-fp1.Y)/(fp2.X-fp1.X))*180/pi;
                        }
                        ang1=Math.Abs(ang1);
                        if (fp2.Y > fp1.Y) angp = 90 - ang - (90 - ang1);
                        else angp = 90 + ang - (90 - ang1);*/
            Vector2 fpp = new Vector2((fp1.X + fp2.X) / 2.0, (fp1.Y + fp2.Y) / 2.0);
            double ang1 = 0, ang2 = 0, ang3 = 0;
            if (ang > -90 && ang <= 90)
            {
                ang1 = ang; ang2 = 90 + ang; ang3 = ang2;
            }
            if (ang >= -180 && ang <= -90)
            {
                ang1 = 180 + ang; ang2 = 90 + ang; ang3 = ang2 + 180;
            }
            if (ang > 90 && ang <= 180)
            {
                ang1 = ang - 180; ang2 = ang - 270; ang3 = ang2 + 180;
            }
            Vector2 fp7p = new Vector2(fpp.X + offset * Math.Cos(ang2 * pi / 180), fpp.Y + offset * Math.Sin(ang2 * pi / 180));

            double xx = (fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X - fp1.Y + Math.Tan(ang2 * pi / 180) * fp1.X) / (Math.Tan(ang2 * pi / 180) - Math.Tan(ang1 * pi / 180));
            double yy = Math.Tan(ang1 * pi / 180) * xx + fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X;
            if (ang1 == 90.0 || ang1 == -90.0)
            {
                xx = fp7p.X;
                yy = fp1.Y;
            }
            Vector2 fp3 = new Vector2(xx, yy);

            double xx1 = (fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X - fp2.Y + Math.Tan(ang2 * pi / 180) * fp2.X) / (Math.Tan(ang2 * pi / 180) - Math.Tan(ang1 * pi / 180));
            double yy1 = Math.Tan(ang1 * pi / 180) * xx1 + fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X;
            if (ang1 == 90.0 || ang1 == -90.0)
            {
                xx1 = fp7p.X;
                yy1 = fp2.Y;
            }

            Vector2 fp4 = new Vector2(xx1, yy1);

            double lp3p4 = distance1(fp3, fp4);

            Vector2 fp5 = new Vector2(fp3.X + 2 * Math.Cos(ang2 * pi / 180), fp3.Y + 2 * Math.Sin(ang2 * pi / 180));
            Vector2 fp6 = new Vector2(fp4.X + 2 * Math.Cos(ang2 * pi / 180), fp4.Y + 2 * Math.Sin(ang2 * pi / 180));
            Vector2 fpl, fpr;
            fpl = fp3; fpr = fp4;

            if (ang >= 0 && ang <= 90)
            {
                if (fp3.X < fp4.X || fp3.Y < fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang > -90 && ang < 0)
            {
                if (fp3.X < fp4.X || fp3.Y > fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang > 90 && ang <= 180)
            {
                if (fp3.X < fp4.X || fp3.Y > fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang >= -180 && ang <= -90)
            {
                if (fp3.X < fp4.X || fp3.Y < fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }

            Vector2 fp7pp = new Vector2(fpl.X + 2.5 / distance1(fp3, fp4) * (fpl.X - fpr.X), fpl.Y + 2.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp7 = new Vector2(fp7pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp7pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp8 = new Vector2(fp7pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp7pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp9pp = new Vector2(fpl.X + 2.5 / distance1(fpr, fpl) * (fpr.X - fpl.X), fpl.Y + 2.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp9 = new Vector2(fp9pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp9pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp10 = new Vector2(fp9pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp9pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp11pp = new Vector2(fpr.X + 2.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fpr.Y + 2.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp11 = new Vector2(fp11pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp11pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp12 = new Vector2(fp11pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp11pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp13pp = new Vector2(fpr.X + 2.5 / distance1(fpl, fpr) * (fpl.X - fpr.X), fpr.Y + 2.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp13 = new Vector2(fp13pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp13pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp14 = new Vector2(fp13pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp13pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp15 = new Vector2(fpl.X + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpl.X - fpr.X),
                                       fpl.Y + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp16 = new Vector2(fpr.X + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpr.X - fpl.X),
                                       fpr.Y + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));

            double jl, angtext;
            //           if (ang > -90 && ang <= 90) jl = 2;
            //           else jl = -2;
            jl = 2;
            angtext = ang1;

            double sxl = 0.0;
            if (!text.Contains("(")) sxl = -4;

            double lentexttol = text.Length * 3.5 * 0.7 + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7;

            Vector2 fp18 = new Vector2(fp15.X + jl * Math.Cos(ang3 * pi / 180), fp15.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp21 = new Vector2(fp16.X + jl * Math.Cos(ang3 * pi / 180), fp16.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp21p = new Vector2(fp21.X - (Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 + sxl) * 0.5 * Math.Cos(ang1 * pi / 180), fp21.Y - (Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 + sxl) * 0.5 * Math.Sin(ang1 * pi / 180));
            Vector2 fp21pp = new Vector2(fp21p.X + (Math.Max(tol.Length, toh.Length) * 0.7 * 1.5 + 4) * 0.5 * Math.Cos(ang1 * pi / 180), fp21p.Y + (Math.Max(tol.Length, toh.Length) * 0.7 * 1.5 + 4) * 0.5 * Math.Sin(ang1 * pi / 180));

            Vector2 fp19 = new Vector2(fp18.X + (lentexttol + 6 + sxl) * 0.5 * Math.Cos(ang1 * pi / 180), fp18.Y + (lentexttol + 6 + sxl) * 0.5 * Math.Sin(ang1 * pi / 180));
            Vector2 fp19p = new Vector2(fp19.X + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 * Math.Cos(ang1 * pi / 180), fp19.Y + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 * Math.Sin(ang1 * pi / 180));
            Vector2 fp20 = new Vector2(fp21.X - (lentexttol - 4.5) * Math.Cos(ang1 * pi / 180), fp21.Y - (lentexttol - 4.5) * Math.Sin(ang1 * pi / 180));

            Vector2 fp17 = new Vector2(fp7p.X + jl * Math.Cos(ang3 * pi / 180), fp7p.Y + jl * Math.Sin(ang3 * pi / 180));


            Vector2 fp22 = new Vector2(fp17.X +
                lentexttol * 0.5 * 0.5 / distance1(fpl, fpr) * (fpl.X - fpr.X), fp17.Y + lentexttol * 0.5 * 0.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp23 = new Vector2(fp17.X + (lentexttol * 0.5 + 2 + sxl) * 0.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fp17.Y + (lentexttol * 0.5 + 2 + sxl) * 0.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp23p = new Vector2(fp17.X + (lentexttol - 1) * 0.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fp17.Y + (lentexttol - 1) * 0.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));

            Vector2 fp24 = new Vector2(fp19.X + jl * Math.Cos(ang3 * pi / 180), fp19.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp25 = new Vector2(fp23.X + jl * Math.Cos(ang3 * pi / 180), fp23.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp26 = new Vector2(fp21p.X + jl * Math.Cos(ang3 * pi / 180), fp21p.Y + jl * Math.Sin(ang3 * pi / 180));

            if (lentexttol < lp3p4)
            {
                Text text1 = new Text(text, fp22, 0.5, angtext);
                //                    zhc = "context.fillText(\"" + text + "\"," + fp22.X + "," + fp22.Y + ");";
                //                    sw.WriteLine(zhc);


                text1.WidthFactor = 0.7;
                Text text2 = new Text(tol, fp23, 1.5, angtext);
                //                    zhc = "context.fillText(\"" + tol + "\"," + fp23.X + "," + fp23.Y + ");";
                //                    sw.WriteLine(zhc);


                text2.WidthFactor = 0.7;
                Text text3 = new Text(toh, fp25, 1.5, angtext);
                //                    zhc = "context.fillText(\"" + toh + "\"," + fp25.X + "," + fp25.Y + ");";
                //                    sw.WriteLine(zhc);


                text3.WidthFactor = 0.7;
                dxf1.AddEntity(new EntityObject[] { text1, text2, text3 });
                if (text.Contains("("))
                {
                    Text text4 = new Text(")", fp23p, 3.5, angtext);
                    //                        zhc = "context.fillText(\"" + ")" + "\"," + fp23p.X + "," + fp23p.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text4.WidthFactor = 0.7;
                    dxf1.AddEntity(new EntityObject[] { text4 });
                }

                Solid sd1 = new Solid(fpl, fp9, fp10);

                Solid sd2 = new Solid(fpr, fp13, fp14);



                dxf1.AddEntity(new EntityObject[] { sd1, sd2 });
            }
            else
            {
                if (distance1(fpl, fp3) < 0.0001)
                {
                    Text text1 = new Text(text, fp18, 3.5, angtext);
                    //                       zhc = "context.fillText(\"" + text + "\"," + fp18.X + "," + fp18.Y + ");";
                    //                     sw.WriteLine(zhc);


                    text1.WidthFactor = 0.7;
                    Text text2 = new Text(tol, fp19, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + tol + "\"," + fp19.X + "," + fp19.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text2.WidthFactor = 0.7;
                    Text text3 = new Text(toh, fp24, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + toh + "\"," + fp24.X + "," + fp24.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text3.WidthFactor = 0.7;
                    Line linep = new Line(fpl, fp15);


                    Solid sd1 = new Solid(fpl, fp7, fp8);


                    Solid sd2 = new Solid(fpr, fp11, fp12);


                    Line linepp = new Line(fpr, new Vector2((fp16.X + fpr.X) / 2, (fp16.Y + fpr.Y) / 2));


                    dxf1.AddEntity(new EntityObject[] { text1, text2, text3, linep, /*sd1,*/ sd2, linepp });
                    if (text.Contains("("))
                    {
                        Text text4 = new Text(")", fp19p, 3.5, angtext);


                        text4.WidthFactor = 0.7;
                        dxf1.AddEntity(new EntityObject[] { text4 });
                    }

                }
                else
                {
                    Text text1 = new Text(text, fp20, 1, angtext);
                    //                       zhc = "context.fillText(\"" + text + "\"," + fp20.X + "," + fp20.Y + ");";
                    //                       sw.WriteLine(zhc);


                    text1.WidthFactor = 0.7;
                    Text text2 = new Text(tol, fp21p, 1.5, angtext);
                    //                       zhc = "context.fillText(\"" + tol + "\"," + fp21p.X + "," + fp21p.Y + ");";
                    //                       sw.WriteLine(zhc);


                    text2.WidthFactor = 0.7;
                    Text text3 = new Text(toh, fp26, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + toh + "\"," + fp26.X + "," + fp26.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text3.WidthFactor = 0.7;
                    Solid sd1 = new Solid(fpl, fp7, fp8);


                    Solid sd2 = new Solid(fpr, fp11, fp12);


                    Line linep = new Line(fpr, fp16);


                    Line linepp = new Line(fpl, new Vector2((fp15.X + fpl.X) / 2, (fp15.Y + fpl.Y) / 2));


                    dxf1.AddEntity(new EntityObject[] { text1, text2, text3/*, linep*/, linepp, sd1, sd2 });
                    if (text.Contains("("))
                    {
                        Text text4 = new Text(")", fp21pp, 3.5, angtext);
                        //                            zhc = "context.fillText(\"" + ")" + "\"," + fp21pp.X + "," + fp21pp.Y + ");";
                        //                            sw.WriteLine(zhc);


                        text4.WidthFactor = 0.7;
                        dxf1.AddEntity(new EntityObject[] { text4 });
                    }

                }
            }
            Line line1 = new Line(fp1, fp5);


            Line line2 = new Line(fp2, fp6);


            Line line3 = new Line(fp3, fp4);


            dxf1.AddEntity(new EntityObject[] { line1, line2, line3 });
        }
        private static void dimrot1(DxfDocument dxf1, Vector2 fp1, Vector2 fp2, double ang, double offset, String text, String toh, String tol)//(左下）
        {
            Vector2 fp1p = fp1;
            Vector2 fp2p = fp2;
            if (fp2.Y > fp1.Y) { fp1 = fp2p; fp2 = fp1p; }

            double pi = 3.1415926535897;
            //       if (text.Contains("φ")) text = text+"  ";

            /*            double ang1,angp;
                        if (fp2.X == fp1.X)
                        {
                            if (fp2.Y > fp1.Y) ang1 = 90;
                            else ang1 = -90;
                        }
                        else
                        {
                            ang1=Math.Atan((fp2.Y-fp1.Y)/(fp2.X-fp1.X))*180/pi;
                        }
                        ang1=Math.Abs(ang1);
                        if (fp2.Y > fp1.Y) angp = 90 - ang - (90 - ang1);
                        else angp = 90 + ang - (90 - ang1);*/
            Vector2 fpp = new Vector2((fp1.X + fp2.X) / 2.0, (fp1.Y + fp2.Y) / 2.0);
            double ang1 = 0, ang2 = 0, ang3 = 0;
            if (ang > -90 && ang <= 90)
            {
                ang1 = ang; ang2 = 90 + ang; ang3 = ang2;
            }
            if (ang >= -180 && ang <= -90)
            {
                ang1 = 180 + ang; ang2 = 90 + ang; ang3 = ang2 + 180;
            }
            if (ang > 90 && ang <= 180)
            {
                ang1 = ang - 180; ang2 = ang - 270; ang3 = ang2 + 180;
            }
            Vector2 fp7p = new Vector2(fpp.X + offset * Math.Cos(ang2 * pi / 180), fpp.Y + offset * Math.Sin(ang2 * pi / 180));

            double xx = (fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X - fp1.Y + Math.Tan(ang2 * pi / 180) * fp1.X) / (Math.Tan(ang2 * pi / 180) - Math.Tan(ang1 * pi / 180));
            double yy = Math.Tan(ang1 * pi / 180) * xx + fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X;
            if (ang1 == 90.0 || ang1 == -90.0)
            {
                xx = fp7p.X;
                yy = fp1.Y;
            }
            Vector2 fp3 = new Vector2(xx, yy);

            double xx1 = (fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X - fp2.Y + Math.Tan(ang2 * pi / 180) * fp2.X) / (Math.Tan(ang2 * pi / 180) - Math.Tan(ang1 * pi / 180));
            double yy1 = Math.Tan(ang1 * pi / 180) * xx1 + fp7p.Y - Math.Tan(ang1 * pi / 180) * fp7p.X;
            if (ang1 == 90.0 || ang1 == -90.0)
            {
                xx1 = fp7p.X;
                yy1 = fp2.Y;
            }

            Vector2 fp4 = new Vector2(xx1, yy1);

            double lp3p4 = distance1(fp3, fp4);

            Vector2 fp5 = new Vector2(fp3.X + 2 * Math.Cos(ang2 * pi / 180), fp3.Y + 2 * Math.Sin(ang2 * pi / 180));
            Vector2 fp6 = new Vector2(fp4.X + 2 * Math.Cos(ang2 * pi / 180), fp4.Y + 2 * Math.Sin(ang2 * pi / 180));
            Vector2 fpl, fpr;
            fpl = fp3; fpr = fp4;

            if (ang >= 0 && ang <= 90)
            {
                if (fp3.X < fp4.X || fp3.Y < fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang > -90 && ang < 0)
            {
                if (fp3.X < fp4.X || fp3.Y > fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang > 90 && ang <= 180)
            {
                if (fp3.X < fp4.X || fp3.Y > fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }
            if (ang >= -180 && ang <= -90)
            {
                if (fp3.X < fp4.X || fp3.Y < fp4.Y)
                {
                    fpl = fp3; fpr = fp4;
                }
                else
                {
                    fpl = fp4; fpr = fp3;
                }
            }

            Vector2 fp7pp = new Vector2(fpl.X + 2.5 / distance1(fp3, fp4) * (fpl.X - fpr.X), fpl.Y + 2.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp7 = new Vector2(fp7pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp7pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp8 = new Vector2(fp7pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp7pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp9pp = new Vector2(fpl.X + 2.5 / distance1(fpr, fpl) * (fpr.X - fpl.X), fpl.Y + 2.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp9 = new Vector2(fp9pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp9pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp10 = new Vector2(fp9pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp9pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp11pp = new Vector2(fpr.X + 2.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fpr.Y + 2.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp11 = new Vector2(fp11pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp11pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp12 = new Vector2(fp11pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp11pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp13pp = new Vector2(fpr.X + 2.5 / distance1(fpl, fpr) * (fpl.X - fpr.X), fpr.Y + 2.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp13 = new Vector2(fp13pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos(ang2 * pi / 180), fp13pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin(ang2 * pi / 180));
            Vector2 fp14 = new Vector2(fp13pp.X + 2.5 * Math.Tan(10 * pi / 180) * Math.Cos((ang2 + 180) * pi / 180), fp13pp.Y + 2.5 * Math.Tan(10 * pi / 180) * Math.Sin((ang2 + 180) * pi / 180));

            Vector2 fp15 = new Vector2(fpl.X + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpl.X - fpr.X),
                                       fpl.Y + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp16 = new Vector2(fpr.X + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpr.X - fpl.X),
                                       fpr.Y + (text.Length * 3.5 + Math.Max(tol.Length, toh.Length) * 1.5) * 0.7 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));

            double jl, angtext;
            //           if (ang > -90 && ang <= 90) jl = 2;
            //           else jl = -2;
            jl = 2;
            angtext = ang1;

            double sxl = 0.0;
            if (!text.Contains("(")) sxl = -4;

            double lentexttol = text.Length * 3.5 * 0.7 + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7;

            Vector2 fp18 = new Vector2(fp15.X + jl * Math.Cos(ang3 * pi / 180), fp15.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp21 = new Vector2(fp16.X + jl * Math.Cos(ang3 * pi / 180), fp16.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp21p = new Vector2(fp21.X - (Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 + sxl) * 0.5 * Math.Cos(ang1 * pi / 180), fp21.Y - (Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 + sxl) * 0.5 * Math.Sin(ang1 * pi / 180));
            Vector2 fp21pp = new Vector2(fp21p.X + (Math.Max(tol.Length, toh.Length) * 0.7 * 1.5 + 4) * 0.5 * Math.Cos(ang1 * pi / 180), fp21p.Y + (Math.Max(tol.Length, toh.Length) * 0.7 * 1.5 + 4) * 0.5 * Math.Sin(ang1 * pi / 180));

            Vector2 fp19 = new Vector2(fp18.X + (lentexttol + 6 + sxl) * 0.5 * Math.Cos(ang1 * pi / 180), fp18.Y + (lentexttol + 6 + sxl) * 0.5 * Math.Sin(ang1 * pi / 180));
            Vector2 fp19p = new Vector2(fp19.X + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 * Math.Cos(ang1 * pi / 180), fp19.Y + Math.Max(tol.Length, toh.Length) * 1.5 * 0.7 * Math.Sin(ang1 * pi / 180));
            Vector2 fp20 = new Vector2(fp21.X - (lentexttol - 4.5) * Math.Cos(ang1 * pi / 180), fp21.Y - (lentexttol - 4.5) * Math.Sin(ang1 * pi / 180));

            Vector2 fp17 = new Vector2(fp7p.X + jl * Math.Cos(ang3 * pi / 180), fp7p.Y + jl * Math.Sin(ang3 * pi / 180));


            Vector2 fp22 = new Vector2(fp17.X +
                lentexttol * 0.5 * 0.5 / distance1(fpl, fpr) * (fpl.X - fpr.X), fp17.Y + lentexttol * 0.5 * 0.5 / distance1(fpl, fpr) * (fpl.Y - fpr.Y));
            Vector2 fp23 = new Vector2(fp17.X + (lentexttol * 0.5 + 2 + sxl) * 0.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fp17.Y + (lentexttol * 0.5 + 2 + sxl) * 0.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));
            Vector2 fp23p = new Vector2(fp17.X + (lentexttol - 1) * 0.5 / distance1(fpl, fpr) * (fpr.X - fpl.X), fp17.Y + (lentexttol - 1) * 0.5 / distance1(fpl, fpr) * (fpr.Y - fpl.Y));

            Vector2 fp24 = new Vector2(fp19.X + jl * Math.Cos(ang3 * pi / 180), fp19.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp25 = new Vector2(fp23.X + jl * Math.Cos(ang3 * pi / 180), fp23.Y + jl * Math.Sin(ang3 * pi / 180));
            Vector2 fp26 = new Vector2(fp21p.X + jl * Math.Cos(ang3 * pi / 180), fp21p.Y + jl * Math.Sin(ang3 * pi / 180));

            if (lentexttol < lp3p4)
            {
                Text text1 = new Text(text, fp22, 0.5, angtext);
                //                    zhc = "context.fillText(\"" + text + "\"," + fp22.X + "," + fp22.Y + ");";
                //                    sw.WriteLine(zhc);


                text1.WidthFactor = 0.7;
                Text text2 = new Text(tol, fp23, 1.5, angtext);
                //                    zhc = "context.fillText(\"" + tol + "\"," + fp23.X + "," + fp23.Y + ");";
                //                    sw.WriteLine(zhc);


                text2.WidthFactor = 0.7;
                Text text3 = new Text(toh, fp25, 1.5, angtext);
                //                    zhc = "context.fillText(\"" + toh + "\"," + fp25.X + "," + fp25.Y + ");";
                //                    sw.WriteLine(zhc);


                text3.WidthFactor = 0.7;
                dxf1.AddEntity(new EntityObject[] { text1, text2, text3 });
                if (text.Contains("("))
                {
                    Text text4 = new Text(")", fp23p, 3.5, angtext);
                    //                        zhc = "context.fillText(\"" + ")" + "\"," + fp23p.X + "," + fp23p.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text4.WidthFactor = 0.7;
                    dxf1.AddEntity(new EntityObject[] { text4 });
                }

                Solid sd1 = new Solid(fpl, fp9, fp10);

                Solid sd2 = new Solid(fpr, fp13, fp14);



                dxf1.AddEntity(new EntityObject[] { /*sd1,*/ sd2 });
            }
            else
            {
                if (distance1(fpl, fp3) < 0.0001)
                {
                    Text text1 = new Text(text, fp18, 3.5, angtext);
                    //                       zhc = "context.fillText(\"" + text + "\"," + fp18.X + "," + fp18.Y + ");";
                    //                     sw.WriteLine(zhc);


                    text1.WidthFactor = 0.7;
                    Text text2 = new Text(tol, fp19, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + tol + "\"," + fp19.X + "," + fp19.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text2.WidthFactor = 0.7;
                    Text text3 = new Text(toh, fp24, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + toh + "\"," + fp24.X + "," + fp24.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text3.WidthFactor = 0.7;
                    Line linep = new Line(fpl, fp15);


                    Solid sd1 = new Solid(fpl, fp7, fp8);


                    Solid sd2 = new Solid(fpr, fp11, fp12);


                    Line linepp = new Line(fpr, new Vector2((fp16.X + fpr.X) / 2, (fp16.Y + fpr.Y) / 2));


                    dxf1.AddEntity(new EntityObject[] { text1, text2, text3, linep, /*sd1,*/ sd2, linepp });
                    if (text.Contains("("))
                    {
                        Text text4 = new Text(")", fp19p, 3.5, angtext);


                        text4.WidthFactor = 0.7;
                        dxf1.AddEntity(new EntityObject[] { text4 });
                    }

                }
                else
                {
                    Text text1 = new Text(text, fp20, 1, angtext);
                    //                       zhc = "context.fillText(\"" + text + "\"," + fp20.X + "," + fp20.Y + ");";
                    //                       sw.WriteLine(zhc);


                    text1.WidthFactor = 0.7;
                    Text text2 = new Text(tol, fp21p, 1.5, angtext);
                    //                       zhc = "context.fillText(\"" + tol + "\"," + fp21p.X + "," + fp21p.Y + ");";
                    //                       sw.WriteLine(zhc);


                    text2.WidthFactor = 0.7;
                    Text text3 = new Text(toh, fp26, 1.5, angtext);
                    //                        zhc = "context.fillText(\"" + toh + "\"," + fp26.X + "," + fp26.Y + ");";
                    //                        sw.WriteLine(zhc);


                    text3.WidthFactor = 0.7;
                    Solid sd1 = new Solid(fpl, fp7, fp8);


                    Solid sd2 = new Solid(fpr, fp11, fp12);


                    Line linep = new Line(fpr, fp16);


                    Line linepp = new Line(fpl, new Vector2((fp15.X + fpl.X) / 2, (fp15.Y + fpl.Y) / 2));


                    dxf1.AddEntity(new EntityObject[] { text1, text2, text3/*, linep*/, linepp, sd1, sd2 });
                    if (text.Contains("("))
                    {
                        Text text4 = new Text(")", fp21pp, 3.5, angtext);
                        //                            zhc = "context.fillText(\"" + ")" + "\"," + fp21pp.X + "," + fp21pp.Y + ");";
                        //                            sw.WriteLine(zhc);


                        text4.WidthFactor = 0.7;
                        dxf1.AddEntity(new EntityObject[] { text4 });
                    }

                }
            }
            Line line1 = new Line(fp1, fp5);


            Line line2 = new Line(fp2, fp6);


            Line line3 = new Line(fp3, fp4);


            dxf1.AddEntity(new EntityObject[] { line1,/*line2,*/ line3 });
        }

        public static void Standard1182_1(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(10, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 37.5);
            Vector2 v2 = fun.Polar(v1, pi, 30);
            Vector2 v3 = fun.Polar(v2, 90 * pi / 180, 24.25);
            Vector2 v4 = fun.Polar(v3, pi, 122.5);
            Vector2 v6 = fun.Polar(v3, -135 * pi / 180, 23);
            Vector2 v7 = fun.Polar(v2, -135 * pi / 180, 23);
            Vector2 v8 = fun.Polar(v1, -135 * pi / 180, 23);
            Vector2 v9 = new Vector2(v8.X, v0.Y);
            Vector2 v5 = new Vector2(v4.X, v6.Y);
            Vector2 v10 = fun.Polar(v0, 0, 275);
            Vector2 v11 = fun.Polar(v10, 89 * pi / 180, 35.75);
            Vector2 v12 = fun.Polar(v11, 168 * pi / 180, 19);
            Vector2 v13 = fun.Polar(v12, 89 * pi / 180, 18.5);
            Vector2 v14 = fun.Polar(v13, 168 * pi / 180, 128.5);
            Vector2 v15 = fun.Polar(v14, 26*pi/180, 43.5);
            Vector2 v16 = fun.Polar(v13, 26 * pi / 180, 43.5);
            Vector2 v17 = fun.Polar(v12, 26 * pi / 180, 43.5);
            Vector2 v18 = fun.Polar(v11, 26 * pi / 180, 43.5);
            Vector2 v19 = fun.Polar(v10, 26 * pi / 180, 43.5);
            Vector2 v20 = fun.Polar(v10, 168 * pi / 180, 147.5);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v0));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v10));
            line2.Vertexes.Add(new LwPolylineVertex(v20));
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            line2.Vertexes.Add(new LwPolylineVertex(v17));
            line2.Vertexes.Add(new LwPolylineVertex(v18));
            line2.Vertexes.Add(new LwPolylineVertex(v19));
            line2.Vertexes.Add(new LwPolylineVertex(v10));
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v14, v13);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Line line4 = new Line(v13, v12);
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            Line line5 = new Line(v12, v11);
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v11, v10);
            line6.Layer = contour;
            line6.Lineweight = Lineweight.W50;
            dxf.AddEntity(line6);
            Line line7 = new Line(v13, v16);
            line7.Layer = contour;
            line7.Lineweight = Lineweight.W50;
            dxf.AddEntity(line7);
            Line line8 = new Line(v12, v17);
            line8.Layer = contour;
            line8.Lineweight = Lineweight.W50;
            dxf.AddEntity(line8);
            Line line9 = new Line(v11, v18);
            line9.Layer = contour;
            line9.Lineweight = Lineweight.W50;
            dxf.AddEntity(line9);
           




            //填充
            LwPolyline hatchpoly1 = new LwPolyline();
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v0));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v4));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v5));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v6));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v7));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v8));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v9));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v0));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)hatchpoly1.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 5, hline1, harc1, hatching);


            dimrot1(dxf, v1, new Vector2 (v0.X,v0.Y), -90, 10, "", "", "");
            dimrot(dxf, v11, v10, -98, 20, "", "", "");
            fun.gczyx(dxf, fun.Polar(v3, pi, 60), 90, 0);
            fun.gczyx(dxf, fun.Polar(v1, 0, 11), 90, 0);
            fun.gczyx1(dxf, fun.Polar(v13, 156 * pi / 180, 58.75), 90, -5);
            fun.gczyx(dxf, fun.Polar(v11, -8 * pi / 180, 20), 90, -5);


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        
        public static void Standard1182_2(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(10, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 10.75);
            Vector2 v2 = fun.Polar(v1, pi, 100);
            Vector2 v3 = fun.Polar(v2, -90 * pi / 180, 21.5);
            Vector2 v4 = fun.Polar(v0, -90 * pi / 180, 10.75);
            Vector2 v5 = fun.Polar(v0, pi, 110);
            Vector2 v6 = fun.Polar(v0, 0, 10);
            Vector2 v7 = fun.Polar(v0,0, 100);
            Vector2 v8 = fun.Polar(v7, 31 * pi / 180, 76);
            Vector2 v9 = fun.Polar(v7, 117 * pi / 180, 14);
            Vector2 v10 = fun.Polar(v9, 31 * pi / 180, 76);
            Vector2 v11 = fun.Polar(v7, -63 * pi / 180, 14);
            Vector2 v12 = fun.Polar(v11, 31 * pi / 180, 76);
            Vector2 v13 = fun.Polar(v7, -149 * pi / 180, 15);
            Vector2 v14 = fun.Polar(v8, 31 * pi / 180, 15);


            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);

            Line line2 = new Line(v9, v10);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v11, v12);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Ellipse ellipse1 = new Ellipse(v7, 28, 9.73);
            ellipse1.Rotation = 117;
            ellipse1.Layer = contour;
            ellipse1.Lineweight = Lineweight.W50;
            dxf.AddEntity(ellipse1);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(v10));
            Arc1.Vertexes.Add(new LwPolylineVertex(v12));
            Arc1.Vertexes[0].Bulge = Math.Tan(-104 * pi / 180 / 4);
            Arc1.Lineweight = Lineweight.W50;
            Arc1.Layer = contour;
            dxf.AddEntity(Arc1);
            Line line4 = new Line(v13, v14);
            line4.Layer = centre;
            line4.Lineweight = Lineweight.W25;
            line4.Linetype = Linetype.DashDot;
            dxf.AddEntity(line4);
            Line line5 = new Line(v5, v6);
            line5.Layer = centre;
            line5.Lineweight = Lineweight.W25;
            line5.Linetype = Linetype.DashDot;
            dxf.AddEntity(line5);


            dimrot(dxf, v2, v3, 90, 10, "", "", "");
            dimrot(dxf, v9, v11, 121, 20, "", "", "");

            fun.gczyx(dxf, fun.Polar (v1,pi,60),90,0);
            fun.gczyx1(dxf, fun.Polar(v9, 25 * pi / 180, 47.5),90,15);


            



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_3(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 39 * pi / 180, 10.36);
            Vector2 v2 = fun.Polar(v0, 90 * pi / 180, 20);
            Vector2 v3 = fun.Polar(v0, -90 * pi / 180, 20);
            Vector2 v4 = fun.Polar(v0, pi, 20);
            Vector2 v5 = fun.Polar(v0, 0, 20);
            Vector2 v6 = fun.Polar(v0, pi, 27);
            Vector2 v7 = fun.Polar(v0, -90 * pi / 180, 27);
            Vector2 v8 = fun.Polar(v6, 90 * pi / 180, 17.75);
            Vector2 v9 = fun.Polar(v7, 0, 47.65);
            Vector2 v10 = fun.Polar(v8, 10 * pi / 180, 19);
            Vector2 v11 = fun.Polar(v10, 1 * pi / 180, 16.1);
            Vector2 v12 = fun.Polar(v11, -35 * pi / 180, 18.6);
            Vector2 v13 = fun.Polar(v12, -53 * pi / 180, 13.28);
            Vector2 v14 = fun.Polar(v13, -29 * pi / 180, 13.23);
            Vector2 v15 = fun.Polar(v0, -4 * pi / 180, 128);
            Vector2 v16 = fun.Polar(v15, -33 * pi / 180, 4.08);
            Vector2 v17 = fun.Polar(v16, -23 * pi / 180, 1.655);
            Vector2 v18 = fun.Polar(v15, 45 * pi / 180, 10.24);
            Vector2 v19 = fun.Polar(v15, -108 * pi / 180, 10.24);
            Vector2 v20 = fun.Polar(v15, -163 * pi / 180, 12.43);
            Vector2 v21 = fun.Polar(v15, -72 * pi / 180, 19.31);
            Vector2 v22 = fun.Polar(v21, 9 * pi / 180, 39.34);
            Vector2 v23 = fun.Polar(v22, 90 * pi / 180, 46.93);
            Vector2 v24 = fun.Polar(v23, -172 * pi / 180, 56.76);
            Vector2 v25 = fun.Polar(v23, 146 * pi / 180, 12.9);
            Vector2 v26 = fun.Polar(v24, 146 * pi / 180, 12.9);
            Vector2 v27 = fun.Polar(v26, -91 * pi / 180, 31.88);
            Vector2 v28 = fun.Polar(v27, -63 * pi / 180, 12.66);
            Vector2 v29 = fun.Polar(v20, -63 * pi / 180, 13.84);
            Vector2 v30 = fun.Polar(v1, 54 * pi / 180, 32);
            Vector2 v32 = fun.Polar(v30, 0, 10);
            Vector2 v33 = fun.Polar(v17, 54 * pi / 180, 32);
            Vector2 v34 = fun.Polar(v33, 0, 10);


            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v8));
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes[1].Bulge = Math.Tan(90 * pi / 180 / 4);
            line1.Vertexes.Add(new LwPolylineVertex(v9));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            List<Vector3> points = new List<Vector3>
           {

                new Vector3(v8.X,v8.Y, 0),
                new Vector3(v10.X,v10.Y, 0),
                new Vector3(v11.X,v11.Y, 0),
                new Vector3(v12.X,v12.Y, 0),
                new Vector3(v13.X,v13.Y, 0),
                new Vector3(v14.X,v14.Y, 0),
                new Vector3(v9.X,v9.Y, 0),
            };

            Spline spline1 = new Spline(points);
            spline1.Layer = contour;
            DxfDocument doc = new DxfDocument();
            dxf.AddEntity(spline1);
            Line line2 = new Line(v2, v3);
            line2.Layer = centre;
            line2.Lineweight = Lineweight.W25;
            line2.Linetype = Linetype.DashDot;
            dxf.AddEntity(line2);
            Line line3 = new Line(v4, v5);
            line3.Layer = centre;
            line3.Lineweight = Lineweight.W25;
            line3.Linetype = Linetype.DashDot;
            dxf.AddEntity(line3);
            Circle circle1 = new Circle(v0, 6);
            circle1.Layer = contour;
            circle1.Lineweight = Lineweight.W50;
            dxf.AddEntity(circle1);
            Circle circle2 = new Circle(v0, 15.25);
            circle2.Layer = contour;
            circle2.Lineweight = Lineweight.W50;
            dxf.AddEntity(circle2);
            Ellipse ellipse1 = new Ellipse(v15, 8.16, 7.13);
            ellipse1.Rotation = 56;
            ellipse1.Layer = contour;
            ellipse1.Lineweight = Lineweight.W50;
            dxf.AddEntity(ellipse1);
            Ellipse ellipse2 = new Ellipse(v16, 20.36, 17.06);
            ellipse2.Rotation = 65;
            ellipse2.Layer = contour;
            ellipse2.Lineweight = Lineweight.W50;
            dxf.AddEntity(ellipse2);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(v18));
            Arc1.Vertexes.Add(new LwPolylineVertex(v19));
            Arc1.Vertexes[0].Bulge = Math.Tan(-131 * pi / 180 / 4);
            Arc1.Lineweight = Lineweight.W50;
            Arc1.Layer = contour;
            dxf.AddEntity(Arc1);
            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v23));
            line4.Vertexes.Add(new LwPolylineVertex(v22));
            line4.Vertexes.Add(new LwPolylineVertex(v21));
            line4.Vertexes.Add(new LwPolylineVertex(v20));
            line4.Vertexes[2].Bulge = Math.Tan(-104 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v24));
            line4.Vertexes.Add(new LwPolylineVertex(v23));
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            Line line5 = new Line(v23, v25);
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v24, v26);
            line6.Layer = contour;
            line6.Lineweight = Lineweight.W50;
            dxf.AddEntity(line6);
            Line line7 = new Line(v26, v25);
            line7.Layer = contour;
            line7.Lineweight = Lineweight.W50;
            dxf.AddEntity(line7);
            Line line8 = new Line(v26, v27);
            line8.Layer = contour;
            line8.Lineweight = Lineweight.W50;
            dxf.AddEntity(line8);
            Line line9 = new Line(v28, v29);
            line9.Layer = contour;
            line9.Lineweight = Lineweight.W50;
            dxf.AddEntity(line9);
            LwPolyline Arc2 = new LwPolyline();
            Arc2.Vertexes.Add(new LwPolylineVertex(v27));
            Arc2.Vertexes.Add(new LwPolylineVertex(v28));
            Arc2.Vertexes[0].Bulge = Math.Tan(59 * pi / 180 / 4);
            Arc2.Lineweight = Lineweight.W50;
            Arc2.Layer = contour;
            dxf.AddEntity(Arc2);
            Circle circle3 = new Circle(v1, 0.5);
            circle3.Lineweight = Lineweight.W50;
            dxf.AddEntity(circle3);
            Circle circle4 = new Circle(v17, 0.5);
            circle4.Lineweight = Lineweight.W50;
            dxf.AddEntity(circle4);
            Line line10 = new Line(v1,  v30);
            dxf.AddEntity(line10);
            Line line11 = new Line(v30, v32);
            dxf.AddEntity(line11);
            Line line12 = new Line(v17, v33);
            dxf.AddEntity(line12);
            Line line13 = new Line(v33, v34);
            dxf.AddEntity(line13);

            fun.gczyx(dxf, fun.Polar(v32, pi, 2),90,0);
            fun.gczyx(dxf, fun.Polar(v34, pi, 2),90,3);





            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_4(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(10, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 10.75);
            Vector2 v2 = fun.Polar(v1, pi, 100);
            Vector2 v3 = fun.Polar(v2, -90 * pi / 180, 21.5);
            Vector2 v4 = fun.Polar(v0, -90 * pi / 180, 10.75);
            Vector2 v5 = fun.Polar(v0, pi, 110);
            Vector2 v6 = fun.Polar(v0, 0, 10);
            Vector2 v7 = fun.Polar(v0, 0, 100);
            Vector2 v8 = fun.Polar(v7, 31 * pi / 180, 76);
            Vector2 v9 = fun.Polar(v7, 117 * pi / 180, 14);
            Vector2 v10 = fun.Polar(v9, 31 * pi / 180, 76);
            Vector2 v11 = fun.Polar(v7, -63 * pi / 180, 14);
            Vector2 v12 = fun.Polar(v11, 31 * pi / 180, 76);
            Vector2 v13 = fun.Polar(v7, -149 * pi / 180, 15);
            Vector2 v14 = fun.Polar(v8, 31 * pi / 180, 15);


            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);

            Line line2 = new Line(v9, v10);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v11, v12);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Ellipse ellipse1 = new Ellipse(v7, 28, 9.73);
            ellipse1.Rotation = 117;
            ellipse1.Layer = contour;
            ellipse1.Lineweight = Lineweight.W50;
            dxf.AddEntity(ellipse1);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(v10));
            Arc1.Vertexes.Add(new LwPolylineVertex(v12));
            Arc1.Vertexes[0].Bulge = Math.Tan(-104 * pi / 180 / 4);
            Arc1.Lineweight = Lineweight.W50;
            Arc1.Layer = contour;
            dxf.AddEntity(Arc1);
            Line line4 = new Line(v13, v14);
            line4.Layer = centre;
            line4.Lineweight = Lineweight.W25;
            line4.Linetype = Linetype.DashDot;
            dxf.AddEntity(line4);
            Line line5 = new Line(v5, v6);
            line5.Layer = centre;
            line5.Lineweight = Lineweight.W25;
            line5.Linetype = Linetype.DashDot;
            dxf.AddEntity(line5);


            dimrot(dxf, v2, v3, 90, 10, "", "", "");
            dimrot(dxf, v9, v11, 121, 20, "", "", "");

            fun.gczyx(dxf, fun.Polar(v2, pi, 10),90,0);
            fun.gczyx(dxf, fun.Polar(v9, -149 * pi / 180, 20.98),90,15);




            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_5(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 20);
            Vector2 v2 = fun.Polar(v1, pi, 22);
            Vector2 v3 = fun.Polar(v2, -90 * pi / 180, 12);
            Vector2 v4 = fun.Polar(v3, pi, 37);
            Vector2 v5 = fun.Polar(v0, 0, 4);
            Vector2 v6 = new Vector2(v4.X - 4, v0.Y);
            Vector2 v7 = new Vector2(v1.X, -v1.Y);
            Vector2 v8 = new Vector2(v2.X, -v2.Y);
            Vector2 v9 = new Vector2(v3.X, -v3.Y);
            Vector2 v10 = new Vector2(v4.X, -v4.Y);
            Vector2 v11 = fun.Polar(v0, 0, 60);
            Vector2 v12 = fun.Polar(v11, 150 * pi / 180, 8);
            Vector2 v13 = fun.Polar(v11, 90 * pi / 180, 8);
            Vector2 v14 = fun.Polar(v11, -30 * pi / 180, 8);
            Vector2 v15 = fun.Polar(v11, -90 * pi / 180, 8);
            Vector2 v16 = fun.Polar(v11, 30 * pi / 180, 37);
            Vector2 v17 = fun.Polar(v16, 120 * pi / 180, 9.237);
            Vector2 v18 = fun.Polar(v16, 90 * pi / 180, 8);
            Vector2 v19 = fun.Polar(v16, -30 * pi / 180, 8);
            Vector2 v20 = fun.Polar(v16, -60 * pi / 180, 9.237);
            Vector2 v35 = fun.Polar(v11, 120 * pi / 180, 9.237);
            Vector2 v36 = fun.Polar(v11, -60 * pi / 180, 9.237);
            Vector2 v21 = fun.Polar(v16, 175 * pi / 180, 16.26);
            Vector2 v22 = fun.Polar(v16, 150 * pi / 180, 20);
            Vector2 v23 = fun.Polar(v16, 120 * pi / 180, 23.09);
            Vector2 v24 = fun.Polar(v16, 90 * pi / 180, 20);
            Vector2 v25 = fun.Polar(v16, -30 * pi / 180, 20);
            Vector2 v26 = fun.Polar(v16, -60 * pi / 180, 23.09);
            Vector2 v27 = fun.Polar(v16, -90 * pi / 180, 20);
            Vector2 v37 = fun.Polar(v16, -115 * pi / 180, 16.26);
            Vector2 v28 = fun.Polar(v16, 30 * pi / 180, 22);
            Vector2 v29 = fun.Polar(v28, 120 * pi / 180, 23.09);
            Vector2 v30 = fun.Polar(v28, 90 * pi / 180, 20);
            Vector2 v31 = fun.Polar(v28, -30 * pi / 180, 20);
            Vector2 v32 = fun.Polar(v28, -60 * pi / 180, 23.09);
            Vector2 v33 = fun.Polar(v11, -150 * pi / 180, 10);
            Vector2 v34 = fun.Polar(v28, 30 * pi / 180, 19);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v10));
            line1.Vertexes.Add(new LwPolylineVertex(v9));
            line1.Vertexes.Add(new LwPolylineVertex(v8));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes[0].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes[2].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v35));
            line3.Vertexes.Add(new LwPolylineVertex(v17));
            line3.Vertexes.Add(new LwPolylineVertex(v18));
            line3.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v19));
            line3.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v20));
            line3.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v36));
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v21));
            line4.Vertexes.Add(new LwPolylineVertex(v22));
            line4.Vertexes[0].Bulge = Math.Tan(-15 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v24));
            line4.Vertexes[1].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v25));
            line4.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v27));
            line4.Vertexes[3].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v37));
            line4.Vertexes[4].Bulge = Math.Tan(-15 * pi / 180 / 4);
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v23));
            line5.Vertexes.Add(new LwPolylineVertex(v29));
            line5.Vertexes.Add(new LwPolylineVertex(v30));
            line5.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v31));
            line5.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v32));
            line5.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v26));
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v6, v5);
            line6.Layer = centre;
            line6.Lineweight = Lineweight.W25;
            line6.Linetype = Linetype.DashDot;
            dxf.AddEntity(line6);
            Line line7 = new Line(v33, v34);
            line7.Layer = centre;
            line7.Lineweight = Lineweight.W25;
            line7.Linetype = Linetype.DashDot;
            dxf.AddEntity(line7);
            Line line00 = new Line(v3, v9);
            line00.Layer = contour;
            line00.Lineweight = Lineweight.W50;
            dxf.AddEntity(line00);

            dimrot(dxf, v4, v10, 90, 10, "", "", "");
            dimrot(dxf, v13, v15, 120, 20, "", "", "");

            fun.gczyx(dxf, fun.Polar(v4, pi, 10),90,0);
            fun.gczyx(dxf, fun.Polar(v13, -150 * pi / 180, 24),90,15);



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_6(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 6);
            Vector2 v2 = fun.Polar(v1, 0, 13.2);
            Vector2 v3 = fun.Polar(v2, 90 * pi / 180, 8.8);
            Vector2 v4 = fun.Polar(v3, pi, 33);
            Vector2 v5 = new Vector2(v4.X, -v4.Y);
            Vector2 v6 = new Vector2(v3.X, -v3.Y);
            Vector2 v7 = new Vector2(v2.X, -v2.Y);
            Vector2 v8 = new Vector2(v1.X, -v1.Y);
            Vector2 v9 = new Vector2(v4.X - 5, v0.Y);
            Vector2 v10 = new Vector2(v2.X + 5, v0.Y);
            Vector2 v11 = fun.Polar(v6, 0, 60);
            Vector2 v12 = fun.Polar(v11, 90 * pi / 180, 20.8);
            Vector2 v13 = fun.Polar(v12, -13 * pi / 180, 35.71);
            Vector2 v14 = fun.Polar(v13, -90 * pi / 180, 20.8);
            Vector2 v15 = fun.Polar(v14, 90 * pi / 180, 6);
            Vector2 v16 = fun.Polar(v13, -90 * pi / 180, 6);
            Vector2 v17 = fun.Polar(v16, 167 * pi / 180, 15.75);
            Vector2 v18 = fun.Polar(v15, 167 * pi / 180, 15.75);
            Vector2 v19 = fun.Polar(v12, 56 * pi / 180, 33);
            Vector2 v20 = fun.Polar(v13, 56 * pi / 180, 33);
            Vector2 v21 = fun.Polar(v20, -90 * pi / 180, 6);
            Vector2 v22 = fun.Polar(v15, 56 * pi / 180, 33);
            Vector2 v23 = fun.Polar(v14, 56 * pi / 180, 33);
            Vector2 v24 = fun.Polar(v18, 56 * pi / 180, 9.1845);
            Vector2 v25 = fun.Polar(v22, 167 * pi / 180, 5.271);
            Vector2 v26 = fun.Polar(v16, 56 * pi / 180, 33 / 2);
            Vector2 v27 = fun.Polar(v15, 56 * pi / 180, 33 / 2);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v8));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v5));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            line2.Vertexes.Add(new LwPolylineVertex(v17));
            line2.Vertexes.Add(new LwPolylineVertex(v18));
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes.Add(new LwPolylineVertex(v11));
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v12, v19);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Line line4 = new Line(v13, v20);
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            Line line5 = new Line(v16, v21);
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v15, v22);
            line6.Layer = contour;
            line6.Lineweight = Lineweight.W50;
            dxf.AddEntity(line6);
            Line line7 = new Line(v14, v23);
            line7.Layer = contour;
            line7.Lineweight = Lineweight.W50;
            dxf.AddEntity(line7);
            Line line8 = new Line(v19, v20);
            line8.Layer = contour;
            line8.Lineweight = Lineweight.W50;
            dxf.AddEntity(line8);
            Line line9 = new Line(v20, v21);
            line9.Layer = contour;
            line9.Lineweight = Lineweight.W50;
            dxf.AddEntity(line9);
            Line line10 = new Line(v22, v23);
            line10.Layer = contour;
            line10.Lineweight = Lineweight.W50;
            dxf.AddEntity(line10);
            Line line11 = new Line(v22, v25);
            line11.Layer = contour;
            line11.Lineweight = Lineweight.W50;
            dxf.AddEntity(line11);
            Line line12 = new Line(v18, v24);
            line12.Layer = contour;
            line12.Lineweight = Lineweight.W50;
            dxf.AddEntity(line12);
            Line line00 = new Line(v9, v10);
            line00.Layer = centre;
            line00.Lineweight = Lineweight.W25;
            line00.Linetype = Linetype.DashDot;
            dxf.AddEntity(line00);


            dimrot(dxf, v2, v7, -90, 10, "", "", "");
            dimrot(dxf, v26, v27, -103, 20, "", "", "");

            fun.gczyx(dxf, fun.Polar(v2, 0, 10),90,0);
            fun.gczyx(dxf, fun.Polar(v26, -13 * pi / 180, 21),90,-10);


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_7(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 12);
            Vector2 v2 = fun.Polar(v1, pi, 76.5);
            Vector2 v3 = fun.Polar(v2, 90 * pi / 180, 8);
            Vector2 v4 = fun.Polar(v3, pi, 39);
            Vector2 v5 = new Vector2(v4.X, -v4.Y);
            Vector2 v6 = new Vector2(v3.X, -v3.Y);
            Vector2 v7 = new Vector2(v2.X, -v2.Y);
            Vector2 v8 = new Vector2(v1.X, -v1.Y);
            Vector2 v9 = fun.Polar(v0, 0, 5);
            Vector2 v10 = new Vector2(v4.X - 10, v0.Y);
            Vector2 v11 = fun.Polar(v0, -4 * pi / 180, 140);
            Vector2 v12 = fun.Polar(v11, 90 * pi / 180, 12);
            Vector2 v13 = fun.Polar(v11, 30 * pi / 180, 12);
            Vector2 v14 = fun.Polar(v11, -90 * pi / 180, 12);
            Vector2 v15 = fun.Polar(v11, -150 * pi / 180, 12);
            Vector2 v16 = fun.Polar(v11, 60 * pi / 180, 13.856);
            Vector2 v17 = fun.Polar(v11, -120 * pi / 180, 13.856);
            Vector2 v18 = fun.Polar(v11, 150 * pi / 180, 76.5);
            Vector2 v19 = fun.Polar(v16, 150 * pi / 180, 76.5);
            Vector2 v20 = fun.Polar(v18, 90 * pi / 180, 12);
            Vector2 v21 = fun.Polar(v18, -150 * pi / 180, 12);
            Vector2 v22 = fun.Polar(v18, -120 * pi / 180, 13.856);
            Vector2 v23 = fun.Polar(v18, 20 * pi / 180, 18.1667);
            Vector2 v24 = fun.Polar(v18, 30 * pi / 180, 20);
            Vector2 v25 = fun.Polar(v18, 60 * pi / 180, 23.09);
            Vector2 v26 = fun.Polar(v18, 90 * pi / 180, 20);
            Vector2 v27 = fun.Polar(v18, -150 * pi / 180, 20);
            Vector2 v28 = fun.Polar(v18, -120 * pi / 180, 23.09);
            Vector2 v29 = fun.Polar(v18, -90 * pi / 180, 20);
            Vector2 v30 = fun.Polar(v18, -80 * pi / 180, 18.667);
            Vector2 v31 = fun.Polar(v18, 150 * pi / 180, 39);
            Vector2 v32 = fun.Polar(v25, 150 * pi / 180, 39);
            Vector2 v33 = fun.Polar(v26, 150 * pi / 180, 39);
            Vector2 v34 = fun.Polar(v27, 150 * pi / 180, 39);
            Vector2 v35 = fun.Polar(v28, 150 * pi / 180, 39);
            Vector2 v36 = fun.Polar(v11, -30 * pi / 180, 15);
            Vector2 v37 = fun.Polar(v31, 150 * pi / 180, 25);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v5));
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes.Add(new LwPolylineVertex(v8));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes[0].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes[2].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v17));
            line3.Vertexes.Add(new LwPolylineVertex(v22));
            line3.Vertexes.Add(new LwPolylineVertex(v21));
            line3.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v20));
            line3.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v19));
            line3.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line3.Vertexes.Add(new LwPolylineVertex(v16));
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v30));
            line4.Vertexes.Add(new LwPolylineVertex(v29));
            line4.Vertexes[0].Bulge = Math.Tan(-15 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v27));
            line4.Vertexes[1].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v26));
            line4.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v24));
            line4.Vertexes[3].Bulge = Math.Tan(-120 * pi / 180 / 4);
            line4.Vertexes.Add(new LwPolylineVertex(v23));
            line4.Vertexes[4].Bulge = Math.Tan(-15 * pi / 180 / 4);
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v28));
            line5.Vertexes.Add(new LwPolylineVertex(v35));
            line5.Vertexes.Add(new LwPolylineVertex(v34));
            line5.Vertexes[1].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v33));
            line5.Vertexes[2].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v32));
            line5.Vertexes[3].Bulge = Math.Tan(-60 * pi / 180 / 4);
            line5.Vertexes.Add(new LwPolylineVertex(v25));
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v9, v10);
            line6.Layer = centre;
            line6.Lineweight = Lineweight.W25;
            line6.Linetype = Linetype.DashDot;
            dxf.AddEntity(line6);
            Line line7 = new Line(v36, v37);
            line7.Layer = centre;
            line7.Lineweight = Lineweight.W25;
            line7.Linetype = Linetype.DashDot;
            dxf.AddEntity(line7);
            Line line00 = new Line(v2, v7);
            line00.Layer = contour;
            line00.Lineweight = Lineweight.W50;
            dxf.AddEntity(line00);

           

            fun.gczyx2(dxf, fun.Polar(v2, 0, 25),90,0);
            fun.gczyx3(dxf, fun.Polar(v11, 140 * pi / 180, 37),90,-30);
            fun.xwgcfh(dxf, new Vector2(v0.X - 16.5, v0.Y + 53.5), "zxys");
            fun.xwgcfh(dxf, new Vector2(v0.X + 143.79, v0.Y + 36.77), "zxys");





            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_8(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 15.5);
            Vector2 v2 = fun.Polar(v1, 90 * pi / 180, 13.5);
            Vector2 v4 = fun.Polar(v1, pi, 76);
            Vector2 v3 = fun.Polar(v4, 90 * pi / 180, 31.5);
            Vector2 v5 = new Vector2(v4.X, -v4.Y);
            Vector2 v6 = new Vector2(v3.X, -v3.Y);
            Vector2 v7 = new Vector2(v2.X, -v2.Y);
            Vector2 v8 = new Vector2(v1.X, -v1.Y);
            Vector2 v9 = new Vector2(v3.X - 5, v0.Y);
            Vector2 v10 = new Vector2(v0.X + 5, v0.Y);
            Vector2 v11 = fun.Polar(v0, 147 * pi / 180, 59.95);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes[0].Bulge = Math.Tan(-50 * pi / 180 / 4);
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes[2].Bulge = Math.Tan(-50 * pi / 180 / 4);
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            Line line2 = new Line(v4, v1);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v5, v8);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Line line4 = new Line(v9, v10);
            line4.Layer = centre;
            line4.Lineweight = Lineweight.W25;
            line4.Linetype = Linetype.DashDot;
            dxf.AddEntity(line4);


            dimrot(dxf, v4, v5, 90, 10, "", "", "");
            fun.gczyx2(dxf, v11, 74, 0);

            fun.xwgcfh(dxf, new Vector2(v0.X - 15.34, v0.Y + 72.54), "ytd");
            Text text1 = new Text("0.1", new Vector2(v0.X -9.31, v0.Y + 70), 5, 0);
            dxf.AddEntity(text1);
            Text text2 = new Text("A", new Vector2(v0.X +4, v0.Y + 70), 5, 0);
            dxf.AddEntity(text2);

            //填充
            LwPolyline hatchpoly1 = new LwPolyline();
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));
            hatchpoly1.Vertexes[0].Bulge = Math.Tan(-50 * pi / 180 / 4);
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v4));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)hatchpoly1.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 15, hline1, harc1, hatching);

            LwPolyline hatchpoly2 = new LwPolyline();
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v5));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v6));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v7));
            hatchpoly2.Vertexes[1].Bulge = Math.Tan(-50 * pi / 180 / 4);
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v8));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v5));
            hatchpoly2.IsClosed = true;
            String[] htype2 = new String[200];
            Line[] hline2 = new Line[200];
            Arc[] harc2 = new Arc[200];
            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst2; i++)
            {
                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)hatchpoly2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 45, 25, hline2, harc2, hatching);


            Vector2 a1 = new Vector2(v4.X - 10, v4.Y);
            Vector2 a2 = fun.Polar(a1, pi, 1.5);
            Vector2 a3 = fun.Polar(a1, 90 * pi / 180, 1.5);
            Vector2 a4 = fun.Polar(a1, 0, 1.5);
            Vector2 a5 = fun.Polar(a3, 90 * pi / 180, 2.5);
            Vector2 a6 = fun.Polar(a5, pi, 3);
            Vector2 a7 = fun.Polar(a6, 90 * pi / 180, 6);
            Vector2 a8 = fun.Polar(a7, 0, 6);
            Vector2 a9 = fun.Polar(a5, 0, 3);
            Vector2 a10 = fun.Polar(a6, 37 * pi / 180, 1.21);

            Solid solid = new Solid(a2, a4, a3)
            {
                Layer = Layer.Default,
                Linetype = Linetype.ByBlock,
                Color = AciColor.ByBlock
            };
            dxf.AddEntity(solid);

            Line line5 = new Line(a3, a5);
            dxf.AddEntity(line5);
            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(a6));
            line6.Vertexes.Add(new LwPolylineVertex(a7));
            line6.Vertexes.Add(new LwPolylineVertex(a8));
            line6.Vertexes.Add(new LwPolylineVertex(a9));
            line6.Vertexes.Add(new LwPolylineVertex(a6));
            dxf.AddEntity(line6);
            Text text3 = new Text("A", a10, 5, 0);
            dxf.AddEntity(text3);


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_9(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, pi, 95);
            Vector2 v2 = fun.Polar(v0, 100 * pi / 180, 98.6);
            Vector2 v3 = fun.Polar(v2, -81 * pi / 180, 58);
            Vector2 v4 = fun.Polar(v2, -81 * pi / 180, 93.7);
            Vector2 v5 = fun.Polar(v2, -89 * pi / 180, 58);
            Vector2 v6 = fun.Polar(v2, -89 * pi / 180, 93.7);
            Vector2 v7 = fun.Polar(v2, -97 * pi / 180, 58);
            Vector2 v8 = fun.Polar(v2, -97 * pi / 180, 93.7);
            Vector2 v9 = fun.Polar(v2, -105 * pi / 180, 58);
            Vector2 v10 = fun.Polar(v2, -105 * pi / 180, 93.7);
            Vector2 v11 = fun.Polar(v2, -113 * pi / 180, 58);
            Vector2 v12 = fun.Polar(v2, -113 * pi / 180, 93.7);
            Vector2 v13 = fun.Polar(v2, -121 * pi / 180, 58);
            Vector2 v14 = fun.Polar(v2, -121 * pi / 180, 93.7);
            Vector2 v15 = fun.Polar(v2, -129 * pi / 180, 58);
            Vector2 v16 = fun.Polar(v2, -129 * pi / 180, 93.7);
            Vector2 v17 = fun.Polar(v3, -88 * pi / 180, 16.5);
            Vector2 v18 = fun.Polar(v3, -74 * pi / 180, 16.5);
            Vector2 v19 = fun.Polar(v17, -81 * pi / 180, 10);
            Vector2 v20 = fun.Polar(v18, -81 * pi / 180, 10);
            Vector2 v21 = fun.Polar(v5, -96 * pi / 180, 16.5);
            Vector2 v22 = fun.Polar(v5, -82 * pi / 180, 16.5);
            Vector2 v23 = fun.Polar(v21, -89 * pi / 180, 10);
            Vector2 v24 = fun.Polar(v22, -89 * pi / 180, 10);
            Vector2 v25 = fun.Polar(v7, -104 * pi / 180, 16.5);
            Vector2 v26 = fun.Polar(v7, -90 * pi / 180, 16.5);
            Vector2 v27 = fun.Polar(v25, -97 * pi / 180, 10);
            Vector2 v28 = fun.Polar(v26, -97 * pi / 180, 10);
            Vector2 v29 = fun.Polar(v9, -112 * pi / 180, 16.5);
            Vector2 v30 = fun.Polar(v9, -98 * pi / 180, 16.5);
            Vector2 v31 = fun.Polar(v29, -105 * pi / 180, 10);
            Vector2 v32 = fun.Polar(v30, -105 * pi / 180, 10);
            Vector2 v33 = fun.Polar(v11, -120 * pi / 180, 16.5);
            Vector2 v34 = fun.Polar(v11, -106 * pi / 180, 16.5);
            Vector2 v35 = fun.Polar(v33, -113 * pi / 180, 10);
            Vector2 v36 = fun.Polar(v34, -113 * pi / 180, 10);
            Vector2 v37 = fun.Polar(v13, -128 * pi / 180, 16.5);
            Vector2 v38 = fun.Polar(v13, -114 * pi / 180, 16.5);
            Vector2 v39 = fun.Polar(v37, -121 * pi / 180, 10);
            Vector2 v40 = fun.Polar(v38, -121 * pi / 180, 10);
            Vector2 v41 = fun.Polar(v15, -136 * pi / 180, 16.5);
            Vector2 v42 = fun.Polar(v15, -122 * pi / 180, 16.5);
            Vector2 v43 = fun.Polar(v41, -129 * pi / 180, 10);
            Vector2 v44 = fun.Polar(v42, -129 * pi / 180, 10);




            Line line1 = new Line(v3, v4);
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);
            Line line2 = new Line(v5, v6);
            line2.Layer = contour;
            line2.Lineweight = Lineweight.W50;
            dxf.AddEntity(line2);
            Line line3 = new Line(v7, v8);
            line3.Layer = contour;
            line3.Lineweight = Lineweight.W50;
            dxf.AddEntity(line3);
            Line line4 = new Line(v9, v10);
            line4.Layer = contour;
            line4.Lineweight = Lineweight.W50;
            dxf.AddEntity(line4);
            Line line5 = new Line(v11, v12);
            line5.Layer = contour;
            line5.Lineweight = Lineweight.W50;
            dxf.AddEntity(line5);
            Line line6 = new Line(v13, v14);
            line6.Layer = contour;
            line6.Lineweight = Lineweight.W50;
            dxf.AddEntity(line6);
            Line line7 = new Line(v15, v16);
            line7.Layer = contour;
            line7.Lineweight = Lineweight.W50;
            dxf.AddEntity(line7);
            Line line8 = new Line(v17, v18);
            line8.Layer = contour;
            line8.Lineweight = Lineweight.W50;
            dxf.AddEntity(line8);
            Line line9 = new Line(v19, v20);
            line9.Layer = contour;
            line9.Lineweight = Lineweight.W50;
            dxf.AddEntity(line9);
            Line line10 = new Line(v21, v22);
            line10.Layer = contour;
            line10.Lineweight = Lineweight.W50;
            dxf.AddEntity(line10);
            Line line11 = new Line(v23, v24);
            line11.Layer = contour;
            line11.Lineweight = Lineweight.W50;
            dxf.AddEntity(line11);
            Line line12 = new Line(v25, v26);
            line12.Layer = contour;
            line12.Lineweight = Lineweight.W50;
            dxf.AddEntity(line12);
            Line line13 = new Line(v27, v28);
            line13.Layer = contour;
            line13.Lineweight = Lineweight.W50;
            dxf.AddEntity(line13);
            Line line14 = new Line(v29, v30);
            line14.Layer = contour;
            line14.Lineweight = Lineweight.W50;
            dxf.AddEntity(line14);
            Line line15 = new Line(v31, v32);
            line15.Layer = contour;
            line15.Lineweight = Lineweight.W50;
            dxf.AddEntity(line15);
            Line line16 = new Line(v33, v34);
            line16.Layer = contour;
            line16.Lineweight = Lineweight.W50;
            dxf.AddEntity(line16);
            Line line17 = new Line(v35, v36);
            line17.Layer = contour;
            line17.Lineweight = Lineweight.W50;
            dxf.AddEntity(line17);
            Line line18 = new Line(v37, v38);
            line18.Layer = contour;
            line18.Lineweight = Lineweight.W50;
            dxf.AddEntity(line18);
            Line line19 = new Line(v39, v40);
            line19.Layer = contour;
            line19.Lineweight = Lineweight.W50;
            dxf.AddEntity(line19);
            Line line20 = new Line(v41, v42);
            line20.Layer = contour;
            line20.Lineweight = Lineweight.W50;
            dxf.AddEntity(line20);
            Line line21 = new Line(v43, v44);
            line21.Layer = contour;
            line21.Lineweight = Lineweight.W50;
            dxf.AddEntity(line21);

            Line line22 = new Line(v0, v1);
            line22.Layer = contour;
            line22.Lineweight = Lineweight.W100;
            line22.Linetype = Linetype.PHANTOM;
            dxf.AddEntity(line22);

           

            dimrot(dxf, v41, v43, 51, 10, "t", "", "");
            
            
            fun.jt(dxf, fun.Polar(v1, 0, 45), -130, 20,4, "a");



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_10(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, 91.7);
            Vector2 v2 = fun.Polar(v0, pi, 195);
            Vector2 v3 = fun.Polar(v0, 139 * pi / 180, 120.71);
            Vector2 v4 = fun.Polar(v0, 155 * pi / 180, 143.37);
            Vector2 v5 = fun.Polar(v0, 142 * pi / 180, 163.42);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes[0].Bulge = Math.Tan(59 * pi / 180 / 4);
            line1.Vertexes.Add(new LwPolylineVertex(v0));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Layer = contour;
            line1.Lineweight = Lineweight.W50;
            dxf.AddEntity(line1);


            fun.jt(dxf, v1, 45, 17,4, "K");
            fun.jt(dxf, v2, -149, 18, 4,"J");
            fun.jt(dxf, v3, -70, 40, 4,"R15");

            fun.gczyx(dxf, v4, 130, 0);
            fun.xwgcfh(dxf, fun.Polar(v0, 145 * pi / 180, 162.03), "mlkd");
            Text text3 = new Text("0.1-0.2", fun.Polar (v0,144.6*pi/180,157.746), 2, 0);
            dxf.AddEntity(text3);

            fun.jt(dxf, fun.Polar(v5, 0, 5), 180, 5,4, "K");
            fun.jt(dxf, fun.Polar(v5, pi, 5), 0, 5, 4,"J");


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_11(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI; 
            double c = 3.5;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 135 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 v2 = fun.Polar(v0, -135 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 v3 = fun.Polar(v1, pi, 8 * c);
            Vector2 v4 = fun.Polar(v2, pi, 8 * c);
            Vector2 v5 = new Vector2(v3.X - 2, v0.Y);
            Vector2 v6 = fun.Polar(v5, 135 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 v7 = fun.Polar(v5, -135 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 v8 = fun.Polar(v7, pi, 2 * c);
            Vector2 v9 = new Vector2(v8.X, v6.Y);
            Vector2 v10 = fun.Polar(v9, pi, 2 * c);
            Vector2 v11 = new Vector2(v10.X, v8.Y);
            Vector2 v12 = fun.Polar(v5, pi, 6 * c);
            Vector2 v13 = fun.Polar(v12, 90 * pi / 180, c);
            Vector2 v14 = fun.Polar(v12, -90 * pi / 180, c);
            Vector2 v15 = fun.Polar(v13, pi, 2 * c);
            Vector2 v16 = fun.Polar(v14, pi, 2 * c);
            Vector2 v17 = fun.Polar(v15, pi, 2 * c);
            Vector2 v18 = fun.Polar(v16, pi, 2 * c);
            Vector2 v19 = fun.Polar(v17, pi, 4 * c);
            Vector2 v20 = fun.Polar(v18, pi, 4 * c);
            Vector2 v21 = fun.Polar(v19, pi, 2 * c);
            Vector2 v22 = fun.Polar(v20, pi, 2 * c);
            Vector2 v23 = fun.Polar(v13, 90 * pi / 180, c);
            Vector2 v24 = fun.Polar(v23, 90 * pi / 180, 2 * c);
            Vector2 v25 = fun.Polar(v21, 90 * pi / 180, c);
            Vector2 v26 = fun.Polar(v25, 90 * pi / 180, 2 * c);
            Vector2 v27 = fun.Polar(v22, -90 * pi / 180, c);
            Vector2 v28 = fun.Polar(v14, -90 * pi / 180, c);
            Vector2 v29 = fun.Polar(v28, -90 * pi / 180, 2 * c);
            Vector2 v30 = fun.Polar(v27, -90 * pi / 180, 2 * c);
            Vector2 v31 = new Vector2(v21.X, v0.Y);
            Vector2 v32 = fun.Polar(v31, pi, 6 * c);
            Vector2 v33 = fun.Polar(v32, -90 * pi / 180, 5 * c);
            Vector2 V1 = fun.Polar(v0, 45 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 V2 = fun.Polar(v0, -45 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 V3 = fun.Polar(v1, 0, 8 * c);
            Vector2 V4 = fun.Polar(v2, 0, 8 * c);
            Vector2 V5 = fun.Polar(V3, 0, c);
            Vector2 V6 = fun.Polar(V5, 0, 2 * c);
            Vector2 V7 = fun.Polar(V6, 0, 4 * c);
            Vector2 V8 = fun.Polar(V7, 0, 2 * c);
            Vector2 V9 = fun.Polar(V8, 0, 2 * c);
            Vector2 V10 = new Vector2(V9.X, V2.Y);
            Vector2 V11 = new Vector2(V8.X, V2.Y);
            Vector2 V12 = new Vector2(V7.X, V2.Y);
            Vector2 V13 = new Vector2(V6.X, V2.Y);
            Vector2 V14 = new Vector2(V5.X, V2.Y);
            Vector2 V15 = new Vector2(V9.X, v0.Y);
            Vector2 V16 = fun.Polar(V9, 0, c);
            Vector2 V17 = fun.Polar(V16, 0, 2 * c);
            Vector2 V18 = fun.Polar(V17, 0, 2 * c);
            Vector2 V19 = new Vector2(V18.X, V2.Y);
            Vector2 V20 = new Vector2(V17.X, V2.Y);
            Vector2 V21 = new Vector2(V16.X, V2.Y);
            Vector2 V22 = fun.Polar(V19, 45 * pi / 180, c / Math.Sin(45 * pi / 180));
            Vector2 V23 = fun.Polar(V5, 90 * pi / 180, c);
            Vector2 V24 = fun.Polar(V9, 90 * pi / 180, c);
            Vector2 V25 = fun.Polar(V23, 90 * pi / 180, 2 * c);
            Vector2 V26 = fun.Polar(V24, 90 * pi / 180, 2 * c);
            Vector2 V27 = fun.Polar(V14, -90 * pi / 180, c);
            Vector2 V28 = fun.Polar(V10, -90 * pi / 180, c);
            Vector2 V29 = fun.Polar(V27, -90 * pi / 180, 2 * c);
            Vector2 V30 = fun.Polar(V28, -90 * pi / 180, 2 * c);
            Vector2 V31 = fun.Polar(V22, 0, 6 * c);
            Vector2 V32 = fun.Polar(V31, -90 * pi / 180, 5 * c);


            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v33));
            line1.Vertexes.Add(new LwPolylineVertex(v32));
            line1.Vertexes.Add(new LwPolylineVertex(v31));
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v21));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes.Add(new LwPolylineVertex(v22));
            line2.Vertexes.Add(new LwPolylineVertex(v21));
            dxf.AddEntity(line2);
            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v12));
            line3.Vertexes.Add(new LwPolylineVertex(v10));
            line3.Vertexes.Add(new LwPolylineVertex(v6));
            line3.Vertexes.Add(new LwPolylineVertex(v5));
            line3.Vertexes.Add(new LwPolylineVertex(v7));
            line3.Vertexes.Add(new LwPolylineVertex(v11));
            line3.Vertexes.Add(new LwPolylineVertex(v12));
            dxf.AddEntity(line3);
            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v26));
            line4.Vertexes.Add(new LwPolylineVertex(v24));
            line4.Vertexes.Add(new LwPolylineVertex(v23));
            line4.Vertexes.Add(new LwPolylineVertex(v25));
            line4.Vertexes.Add(new LwPolylineVertex(v26));
            dxf.AddEntity(line4);
            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v27));
            line5.Vertexes.Add(new LwPolylineVertex(v28));
            line5.Vertexes.Add(new LwPolylineVertex(v29));
            line5.Vertexes.Add(new LwPolylineVertex(v30));
            line5.Vertexes.Add(new LwPolylineVertex(v27));
            dxf.AddEntity(line5);
            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v3));
            line6.Vertexes.Add(new LwPolylineVertex(v1));
            line6.Vertexes.Add(new LwPolylineVertex(v2));
            line6.Vertexes.Add(new LwPolylineVertex(v4));
            line6.Vertexes.Add(new LwPolylineVertex(v3));
            dxf.AddEntity(line6);


            LwPolyline line7 = new LwPolyline();
            line7.Vertexes.Add(new LwPolylineVertex(V1));
            line7.Vertexes.Add(new LwPolylineVertex(V3));
            line7.Vertexes.Add(new LwPolylineVertex(V4));
            line7.Vertexes.Add(new LwPolylineVertex(V2));
            line7.Vertexes.Add(new LwPolylineVertex(V1));
            dxf.AddEntity(line7);
            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(V25));
            line8.Vertexes.Add(new LwPolylineVertex(V26));
            line8.Vertexes.Add(new LwPolylineVertex(V24));
            line8.Vertexes.Add(new LwPolylineVertex(V23));
            line8.Vertexes.Add(new LwPolylineVertex(V25));
            dxf.AddEntity(line8);
            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(V27));
            line9.Vertexes.Add(new LwPolylineVertex(V28));
            line9.Vertexes.Add(new LwPolylineVertex(V30));
            line9.Vertexes.Add(new LwPolylineVertex(V29));
            line9.Vertexes.Add(new LwPolylineVertex(V27));
            dxf.AddEntity(line9);
            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(V5));
            line10.Vertexes.Add(new LwPolylineVertex(V9));
            line10.Vertexes.Add(new LwPolylineVertex(V10));
            line10.Vertexes.Add(new LwPolylineVertex(V14));
            line10.Vertexes.Add(new LwPolylineVertex(V5));
            dxf.AddEntity(line10);
            LwPolyline line11 = new LwPolyline();
            line11.Vertexes.Add(new LwPolylineVertex(V15));
            line11.Vertexes.Add(new LwPolylineVertex(V16));
            line11.Vertexes.Add(new LwPolylineVertex(V18));
            line11.Vertexes.Add(new LwPolylineVertex(V22));
            line11.Vertexes.Add(new LwPolylineVertex(V19));
            line11.Vertexes.Add(new LwPolylineVertex(V21));
            line11.Vertexes.Add(new LwPolylineVertex(V15));
            dxf.AddEntity(line11);
            LwPolyline line12 = new LwPolyline();
            line12.Vertexes.Add(new LwPolylineVertex(V22));
            line12.Vertexes.Add(new LwPolylineVertex(V31));
            line12.Vertexes.Add(new LwPolylineVertex(V32));
            dxf.AddEntity(line12);

            Line line13 = new Line(v19, v20);
            dxf.AddEntity(line13); 
            Line line14 = new Line(v17, v18);
            dxf.AddEntity(line14);
            Line line15 = new Line(v15, v16);
            dxf.AddEntity(line15);
            Line line16 = new Line(v10, v11);
            dxf.AddEntity(line16);
            Line line17 = new Line(v9, v8);
            dxf.AddEntity(line17);
            Line line18 = new Line(v6, v7);
            dxf.AddEntity(line18);
            Line line19 = new Line(V6, V13);
            dxf.AddEntity(line19);
            Line line20 = new Line(V7, V12);
            dxf.AddEntity(line20);
            Line line21 = new Line(V8, V11);
            dxf.AddEntity(line21);
            Line line22 = new Line(V16, V21);
            dxf.AddEntity(line22);
            Line line23 = new Line(V17, V20);
            dxf.AddEntity(line23);
            Line line24 = new Line(V18, V19);
            dxf.AddEntity(line24);

            Solid solid1 = new Solid(v33, fun.Polar(v33, 104 * pi / 180, 2.05), fun.Polar(v33, 76 * pi / 180, 2.05), fun.Polar(v33, 90 * pi / 180, 1.5))
            {
                Layer = Layer.Default,
                Linetype = Linetype.ByBlock,
                Color = AciColor.ByBlock
            };
            dxf.AddEntity(solid1);
            Solid solid2 = new Solid(V32, fun.Polar(V32, 104 * pi / 180, 2.05), fun.Polar(V32, 76 * pi / 180, 2.05), fun.Polar(V32, 90 * pi / 180, 1.5))
            {
                Layer = Layer.Default,
                Linetype = Linetype.ByBlock,
                Color = AciColor.ByBlock
            };
            dxf.AddEntity(solid2);

            fun.xwgcfh(dxf, fun.Polar(v22, 45 * pi / 180, c / Math.Sin(45 * pi / 180)), "wzd");
            fun.xwgcfh(dxf, fun.Polar(v11, 45 * pi / 180, c / Math.Sin(45 * pi / 180)), "czd");
            fun.xwgcfh(dxf, fun.Polar(V14, 45 * pi / 180, c / Math.Sin(45 * pi / 180)), "wzd");
            fun.xwgcfh(dxf, fun.Polar(V21, 45 * pi / 180, c / Math.Sin(45 * pi / 180)), "czd");

            Text text1 = new Text("0.08", fun.Polar(v20,  34 * pi / 180,  4.35), 2, 0);
            dxf.AddEntity(text1);
            Text text2 = new Text("0.08", fun.Polar(V13, 34 * pi / 180, 4.35), 2, 0);
            dxf.AddEntity(text2);
            Text text3 = new Text("A", fun.Polar(v18, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text3);
            Text text4 = new Text("B", fun.Polar(v16, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text4);
            Text text5 = new Text("A", fun.Polar(v8, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text5);
            Text text6 = new Text("A", fun.Polar(V12, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text6);
            Text text7 = new Text("B", fun.Polar(V11, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text7);
            Text text8 = new Text("A", fun.Polar(V20, 43 * pi / 180, 2.54), 4, 0);
            dxf.AddEntity(text8);
            fun.jt(dxf, fun.Polar(v24, pi, 16), 45, 8, 2, "c");
            fun.jt(dxf, fun.Polar(v21, -90 * pi / 180, 1.75), 135, 8, 2, "a");
            fun.jt(dxf, v9, 45, 8, 2, "b");
            fun.jt(dxf, fun.Polar(v28, -90 * pi / 180, 1.75), -45, 8, 2, "c");
            fun.jt(dxf, fun.Polar(v1, pi, 16), 45, 8, 2, "c");

            fun.jt(dxf, fun.Polar(V1, 0, 16), 135, 8, 2, "c");
            fun.jt(dxf, V10, -45, 8, 2, "a");
            fun.jt(dxf, V17, 45, 8, 2, "b");
            fun.jt(dxf, V29, -135, 8, 2, "c");
            fun.jt(dxf, fun.Polar(V25, 0, 16), 45, 8, 2, "c");


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Standard1182_12(Dictionary<string, Object> data)
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
                                                                           //参数
            double pi = Math.PI; 
            double c = 7;
            string path = Convert.ToString(data["path"]);
            //坐标
            Vector2 v0 = new Vector2(0, 0);
            Vector2 v1 = fun.Polar(v0, 90 * pi / 180, c);
            Vector2 v2 = fun.Polar(v1, pi, c);
            Vector2 v3 = fun.Polar(v2, pi, 1.5 * c);
            Vector2 v4 = fun.Polar(v3, pi, c);
            Vector2 v5 = fun.Polar(v4, pi, 2.5 * c);
            Vector2 v6 = fun.Polar(v5, pi, c);
            Vector2 v7 = new Vector2(v6.X, v0.Y);
            Vector2 v8 = new Vector2(v5.X, v0.Y);
            Vector2 v9 = new Vector2(v4.X, v0.Y);
            Vector2 v10 = new Vector2(v3.X, v0.Y);
            Vector2 v11 = new Vector2(v2.X, v0.Y);
            Vector2 v12 = fun.Polar(v7, 130 * pi / 180, 20);
            Vector2 v13 = fun.Polar(v12, 0, c);
            Vector2 v14 = fun.Polar(v13, 0, 2 * c);
            Vector2 v15 = fun.Polar(v12, 90 * pi / 180, c);
            Vector2 v16 = fun.Polar(v15, 0, c);
            Vector2 v17 = fun.Polar(v16, 0, 2 * c);
            Vector2 v18 = fun.Polar(v12, 0, 85);
            Vector2 v19 = fun.Polar(v18, pi, c);
            Vector2 v20 = fun.Polar(v19, pi, c);
            Vector2 v21 = fun.Polar(v20, pi,1.5 * c);
            Vector2 v22 = fun.Polar(v21, pi, c);
            Vector2 v23 = fun.Polar(v22, pi, c);
            Vector2 v24 = fun.Polar(v23, pi, 2 * c);
            Vector2 v25 = new Vector2(v24.X, v15.Y);
            Vector2 v26 = new Vector2(v23.X, v25.Y);
            Vector2 v27 = new Vector2(v22.X, v25.Y);
            Vector2 v28 = new Vector2(v21.X, v25.Y);
            Vector2 v29 = new Vector2(v20.X, v25.Y);
            Vector2 v30 = new Vector2(v19.X, v25.Y);
            Vector2 v31 = new Vector2(v18.X, v25.Y);
            Vector2 v32 = fun.Polar(v9, 80 * pi / 180, 29);
            Vector2 v33 = fun.Polar(v32, 90 * pi / 180, c);
            Vector2 v34 = fun.Polar(v33, pi, 2.5 * c);
            Vector2 v35 = new Vector2(v34.X, v32.Y);
            Vector2 v36 = fun.Polar(v32, 0, 2 * c);
            Vector2 v37 = new Vector2(v36.X, v33.Y);
            Vector2 v38 = fun.Polar(v34, pi, 2 * c);
            Vector2 v39 = new Vector2(v38.X, v35.Y);

            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v0));
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes.Add(new LwPolylineVertex(v0));
            dxf.AddEntity(line1);
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            dxf.AddEntity(line2);
            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v26));
            line3.Vertexes.Add(new LwPolylineVertex(v27));
            line3.Vertexes.Add(new LwPolylineVertex(v22));
            line3.Vertexes.Add(new LwPolylineVertex(v23));
            line3.Vertexes.Add(new LwPolylineVertex(v26));
            dxf.AddEntity(line3);
            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v28));
            line4.Vertexes.Add(new LwPolylineVertex(v29));
            line4.Vertexes.Add(new LwPolylineVertex(v20));
            line4.Vertexes.Add(new LwPolylineVertex(v21));
            line4.Vertexes.Add(new LwPolylineVertex(v28));
            dxf.AddEntity(line4);
            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v30));
            line5.Vertexes.Add(new LwPolylineVertex(v31));
            line5.Vertexes.Add(new LwPolylineVertex(v18));
            line5.Vertexes.Add(new LwPolylineVertex(v19));
            line5.Vertexes.Add(new LwPolylineVertex(v30));
            dxf.AddEntity(line5);
            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v34));
            line6.Vertexes.Add(new LwPolylineVertex(v33));
            line6.Vertexes.Add(new LwPolylineVertex(v32));
            line6.Vertexes.Add(new LwPolylineVertex(v35));
            line6.Vertexes.Add(new LwPolylineVertex(v34));
            dxf.AddEntity(line6);


            Line line7 = new Line(v2, v11);
            dxf.AddEntity(line7);
            Line line8 = new Line(v3, v10);
            dxf.AddEntity(line8);
            Line line9 = new Line(v4, v9);
            dxf.AddEntity(line9);
            Line line10 = new Line(v5, v8);
            dxf.AddEntity(line10);



            Line line11 = new Line(v16, v17);
            line11.Linetype = Linetype.Dashed;
            line11.LinetypeScale = 8;
            dxf.AddEntity(line11);
            Line line12 = new Line(v13, v14);
            line12.Linetype = Linetype.Dashed;
            line12.LinetypeScale = 8;
            dxf.AddEntity(line12);
            Line line13 = new Line(v25, v26);
            line13.Linetype = Linetype.Dashed;
            line13.LinetypeScale = 8;
            dxf.AddEntity(line13);
            Line line14 = new Line(v24, v23);
            line14.Linetype = Linetype.Dashed;
            line14.LinetypeScale = 8;
            dxf.AddEntity(line14);
            Line line15 = new Line(v27, v28);
            line15.Linetype = Linetype.Dashed;
            line15.LinetypeScale = 8;
            dxf.AddEntity(line15);
            Line line16 = new Line(v22, v21);
            line16.Linetype = Linetype.Dashed;
            line16.LinetypeScale = 8;
            dxf.AddEntity(line16);
            Line line17 = new Line(v29, v30);
            line17.Linetype = Linetype.Dashed;
            line17.LinetypeScale = 8;
            dxf.AddEntity(line17);
            Line line18 = new Line(v20, v19);
            line18.Linetype = Linetype.Dashed;
            line18.LinetypeScale = 8;
            dxf.AddEntity(line18);
            Line line19 = new Line(v38, v34);
            line19.Linetype = Linetype.Dashed;
            line19.LinetypeScale = 8;
            dxf.AddEntity(line19);
            Line line20 = new Line(v39, v35);
            line20.Linetype = Linetype.Dashed;
            line20.LinetypeScale = 8;
            dxf.AddEntity(line20);
            Line line21 = new Line(v33, v37);
            line21.Linetype = Linetype.Dashed;
            line21.LinetypeScale = 8;
            dxf.AddEntity(line21);
            Line line22 = new Line(v32, v36);
            line22.Linetype = Linetype.Dashed;
            line22.LinetypeScale = 8;
            dxf.AddEntity(line22);


            fun.jt(dxf, v6, 142, 10.5, 2, " ");
            fun.jt(dxf, fun.Polar(v4, pi, c), 81, 19, 2, " ");
            fun.jt(dxf, fun.Polar(v3, pi, 1), 41, 9, 2, " ");
            fun.jt(dxf, fun.Polar(v2, pi, 2), 26, 13.7, 2, " ");
            fun.jt(dxf, v1, 17, 18.7, 2, " ");













            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

    }
}
